﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Lienhe : System.Web.UI.Page
{
    BUS_Contact objC = new BUS_Contact();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnHuy_Click(object sender, EventArgs e)
    {
        txtName.Text = "";
        txtTel.Text = "";
        txtEmail.Text = "";
        txtTitle.Text = "";
        txtContent.Text = "";
    }
    protected void btnGui_Click(object sender, EventArgs e)
    {
        DTO_Contact contact = new DTO_Contact();
        if (txtName.Text != "" && txtTitle.Text != "" && txtTel.Text != "" && txtEmail.Text != "" && txtContent.Text != "")
        {
            contact.Name = txtName.Text.Trim();
            contact.Title = txtTitle.Text.Trim();
            contact.Phone = txtTel.Text.Trim();
            contact.Email = txtEmail.Text.Trim();
            contact.Content = txtContent.Text.Trim();
            contact.Status = 1;
            if (objC.Contact_Insert(contact))
            {
                Response.Write("<script>alert(\"Gửi liên hệ thành công <..*!>\")</script>");
            }
            else
                Response.Write("<script>alert(\"Không gửi được!\")</script>");
        }
    }
}